package com.gao.service.impl;

import java.sql.SQLException;
import java.util.List;

import com.gao.dao.OrderDao;
import com.gao.dao.impl.OrderDaoImpl;
import com.gao.domain.Order;
import com.gao.service.OrderService;

public class OrderServiceImpl implements OrderService{
	OrderDao orderDao = new OrderDaoImpl();

	@Override
	public boolean add(Order order){
		try {
			return orderDao.insert(order);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public boolean updateNumber(String oid, String newState){
		try {
			return orderDao.updateNumber(oid, newState);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return false;
	}

	@Override
	public List<Order> getOrdersByUid(int uid) {
		try {
			return orderDao.getOrdersByUid(uid);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}

	@Override
	public String getStateByOid(String oid) {
		try {
			return orderDao.getStateByOid(oid);
		} catch (SQLException e) {
			e.printStackTrace();
		}
		return null;
	}
}
